{template 'common/header'}
<div class="main">
    <ul class="nav nav-tabs">
        <li ><a href="{php echo $this->createWebUrl('eggManage');}">砸金蛋管理</a></li>
        <li  class="active"><a href="{php echo $this->createWebUrl('userList',array('egid'=>$egid))}">参加用户</a></li>

    </ul>


    <div class="panel panel-info">
        <div class="panel-heading">{$shake['title']} 参加用户</div>
        <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="mon_egg" />
                <input type="hidden" name="do" value="userList" />
                <input type="hidden" name="egid" value="{$egid}" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">手机号/昵称</label>
                    <div class="col-sm-8 col-lg-9">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
                    </div>
                    <div class=" col-xs-12 col-sm-2 col-lg-2">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    </div>
                </div>
                <div class="form-group">
                </div>
            </form>
        </div>

    </div>


    <div style="padding: 0 15px 0  15px;">
        <div class="row-fluid">
            <div class="span8 control-group">
                <a class="btn btn-default" href="{php echo $this->createWebUrl('uDownload',array('egid'=>$egid))}"><i class="icon-download-alt"></i>导出用户信息</a>
            </div>
        </div>

    </div>


        <div class=" panel panel-default">
            <div class="panel-heading">

               共{$total}人

            </div>
        <div class="table-responsive panel-body">

            <div style="padding:15px;">

                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width: 5px">
                            <input type="checkbox" class="check_all" />
                        </th>
                        <th>openid</th>
                        <th style="width: 80px">姓名</th>
                        <th>手机</th>
                        <th>昵称</th>
                        <th>头像</th>
                        <th>参加时间</td>
                        <th style="width: 300px">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $row}
                    <tr>

                        <td class="with-checkbox">
                            <input type="checkbox" name="check" value="{$row['id']}">
                        </td>
                        <td>{$row['openid']} </td>
                        <td>{if $row['uname']}{$row['uname']}{else}<span class="label label-danger">未绑定</span>{/if} </td>
                        <td>{if $row['tel']}{$row['tel']}{else}<span class="label label-danger">未绑定</span>{/if} </td>
                        <td>{$row['nickname']} </td>
                        <td><img src="{$row['headimgurl']}" width="50px" height="50px"></td>
                        <td>{php echo date("Y-m-d H:i:s", $row['createtime'])}</td>
                        <td >
                            <a class="btn  btn-default" rel="tooltip" href="{php echo $this->createWebUrl('Record_list',array('uid'=>$row['id'],'egid'=>$row['egid']))}" onclick="" title="抽奖记录">抽奖记录<i class="glyphicon glyphicon-list"></i></a>
                            <a class="btn  btn-default" rel="tooltip" href="{php echo $this->createWebUrl('shareList',array('uid'=>$row['id'],'egid'=>$row['egid']))}" onclick="" title="分享奖励记录">分享奖励<i class="glyphicon glyphicon-list"></i></a>
                            <a class="btn  btn-default" rel="tooltip" href="#" onclick="drop_confirm('您确定要删除吗?', '{php echo $this->createWebUrl('userList',array('op'=>delete,'id'=>$row['id']))}');" title="删除">删除<i class="glyphicon glyphicon-remove"></i></a>
                        </td>
                    </tr>
                    {/loop}
                    <tr>
                        <td colspan="8">

                            <input type="button" class="btn btn-primary" name="deleteall" value="删除选择的" />
                        </td>
                    </tr>
                    </tbody>
                </table>
                {$pager}
            </div>

        </div>
    </div>
</div>
<script>
    $(function(){

        $(".check_all").click(function(){

            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").each(function(i){
                $(this).get(0).checked=checked;
            });

        });


        $("input[name=deleteall]").click(function(){


            var check = $("input:checked");
            if (check.length < 1){
                alert('请选择要删除的记录!');
                return false;
            }
            if (confirm("确认要删除选择的记录?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });


                $.post('{php echo $this->createWebUrl('DeleteUser')}', {idArr:id}, function(data){

                    if(data.code==200) {
                        alert("删除成功");
                        location.reload();
                    } else {
                        alert("删除出错，稍后再试!");
                    }

                }, 'json');
            }

        });
    });</script>
<script>
    function drop_confirm(msg, url){
        if (confirm(msg)){
            window.location = url;
        }
    }
</script>

{template 'common/footer'}